﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace EKAABSInformationManagement.Models
{
    public class common
    {
        public static bool isUserInRole(string userName, string roleName)
        {
            MembershipUser user = Membership.GetUser(userName);
            if (user != null)
            {
                string[] roles = Roles.GetRolesForUser(user.UserName);
                foreach (string r in roles)
                {
                    if (r.Trim().ToLower() == roleName) return true;
                }
            }
            return false;
        }
    }
}